package renatre;

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class ConsultaLibreta {

	private static String cuil;
	
	
	public static String getCuil() {
		return cuil;
	}

	private Shell shlResultado;

	public void setCuil(String cuil) {
		ConsultaLibreta.cuil = cuil;
	}

	public ConsultaLibreta(String cuil) {
		ConsultaLibreta.cuil=cuil;
	}

	/**
	 * Launch the application.
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			ConsultaLibreta c = new ConsultaLibreta(getCuil());
			
		} catch (Exception e) {
			// TODO: handle exception
		}
	}
	
	
	
	public void open() {
		Display display = Display.getDefault();
		createContents();
		shlResultado.open();
		shlResultado.layout();
		while (!shlResultado.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
	}

	/**
	 * Create contents of the window.
	 */
	
	
	
	
	
	protected void createContents() {
		shlResultado = new Shell();
		shlResultado.setSize(763, 506);
		shlResultado.setText("Resultado");
		
		shlResultado.setLayout(new FormLayout());
		

		Browser browser = new Browser(shlResultado, SWT.NONE);
		browser.setUrl("http://tramites.renatea.gob.ar/consulta/?cuil=".concat(getCuil())+"&accion=Consultar+CUIL");
		FormData fd_browser = new FormData();
		fd_browser.top = new FormAttachment(0, 10);
		fd_browser.left = new FormAttachment(0, 10);
		fd_browser.right = new FormAttachment(100, -10);
		fd_browser.bottom = new FormAttachment(100, -10);
		browser.setLayoutData(fd_browser);


	}

	
	
}
